﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;

namespace XNASpelProjekt
{
    class Level1 : Map
    {
        #region member variables

        protected Ultros ultros;

        #endregion

        #region constructors

        /// <summary>
        /// Constructor
        /// </summary>
        public Level1()
        {
            backgroundImage = Game1.level1;

            mapCollision = new Rectangle[4];
            mapCollision[0].X = 0;
            mapCollision[0].Y = 0;
            mapCollision[0].Width = 40;
            mapCollision[0].Height = 479;
            mapCollision[1].X = 0;
            mapCollision[1].Y = 0;
            mapCollision[1].Width = 639;
            mapCollision[1].Height = 48;
            mapCollision[2].X = 603;
            mapCollision[2].Y = 0;
            mapCollision[2].Width = 639;
            mapCollision[2].Height = 479;
            mapCollision[3].X = 134;
            mapCollision[3].Y = 413;
            mapCollision[3].Width = 375;
            mapCollision[3].Height = 66;

            mapDeathZone = new Rectangle[2];
            mapDeathZone[0].X = 41;
            mapDeathZone[0].Y = 439;
            mapDeathZone[0].Width = 92;
            mapDeathZone[0].Height = 40;
            mapDeathZone[1].X = 510;
            mapDeathZone[1].Y = 439;
            mapDeathZone[1].Width = 92;
            mapDeathZone[1].Height = 40;

            GravityStrength = 4;

            ultros = new Ultros(525, 411, Actor._Facing.left);
            player = new PlayerActor(Game1.playerImage, 200, 100, Actor._Facing.right);

            enemies = new List<EnemyActor>();
            enemiesToRemove = new List<EnemyActor>();
            enemies.Add(ultros);

            bullets = new List<BulletActor>();
            bulletsToRemove = new List<BulletActor>();
            
            animations = new List<AnimationActor>();
            animationsToRemove = new List<AnimationActor>();
            
            music = Game1.level1Music;
            MediaPlayer.Play(music);
            MediaPlayer.IsRepeating = true;
        }

        #endregion

        #region public methods

        /// <summary>
        /// Draws the map, including all actors on the map
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        /// <param name="spriteBatch">A SpriteBatch is used to draw textures.</param>
        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            //begin spriteBatch drawing
            spriteBatch.Begin();

            base.Draw(gameTime, spriteBatch);

             //end spriteBatch drawing
            spriteBatch.End();           
        }

        #endregion
    }   
}
